package com.spring.shops.dao;

import com.github.pagehelper.Page;
import com.spring.shops.model.dto.SysUserDTO;
import com.spring.shops.model.entity.TzSysUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface TzSysUserMapper {
    int deleteByPrimaryKey(Long userId);

    int insert(TzSysUser record);

    int insertSelective(TzSysUser record);

    TzSysUser selectByPrimaryKey(Long userId);

    int updateByPrimaryKeySelective(TzSysUser record);

    int updateByPrimaryKey(TzSysUser record);

    /**
     * 根据用户名查询用户
     * @param userName
     * @return
     */
    @Select("select * from yami_shops.tz_sys_user where username=#{userName}")
    TzSysUser getByUsername(String userName);
    @Insert("insert into yami_shops.tz_sys_user (username, password, status) VALUES (#{username},#{password},1)")
    void add(TzSysUser user);

    /**
     * 分页查询
     * @param dto
     * @return
     */
    Page<TzSysUser> page(SysUserDTO dto);
}